Skip to content

[CALCITE-7774] JDBC adapter generates a GROUP BY with a constant key, which SQL Server rejects - #5257

Merged
mihaibudiu merged 1 commit into
apache:mainfrom
wasabii:calcite-7774-mssql-group-by-literal
Sep 16, 2026
Merged

mihaibudiu merged 1 commit into
apache:mainfrom
wasabii:calcite-7774-mssql-group-by-literal

Conversation

@wasabii

@wasabii wasabii commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Jira Link

CALCITE-7774

Changes Proposed

MssqlSqlDialect now returns false from supportsGroupByLiteral(), so SqlImplementor.visitRoot applies AggregateProjectConstantToDummyJoinRule and the constant moves out of the GROUP BY into a dummy join. SQL Server has no form of GROUP BY <constant> it will accept, so there was nothing to fix in the unparsing.

Added MSSQL expectations to testGroupByBooleanLiteral and testGroupByDateLiteral, which already cover Redshift and Informix for the same gate.

@sonarqubecloud

Copy link
Copy Markdown

@mihaibudiu mihaibudiu added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Sep 12, 2026
@mihaibudiu
mihaibudiu merged commit 55d2e3b into apache:main Sep 16, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LGTM-will-merge-soon Overall PR looks OK. Only minor things left.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants